package com.arpa.wms.service;

import com.arpa.wms.domain.dto.PackingMaterialGoodsDTO;
import com.arpa.wms.domain.entity.PackingMaterialGoods;
import com.arpa.wms.domain.vo.PackingMaterialGoodsVO;
import com.baomidou.mybatisplus.extension.service.IService;
import org.springframework.scheduling.annotation.Async;

import java.util.List;

/**
 * <p>
 * 包材关系 服务类
 * </p>
 *
 * @author rfwang
 * @since 2021-08-26
 */
public interface IPackingMaterialGoodsService extends IService<PackingMaterialGoods> {

    /**
     * 查询列表
     *
     * @param packingMaterialGoodsDTO
     * @return
     */
    List<PackingMaterialGoodsVO> queryList(PackingMaterialGoodsDTO packingMaterialGoodsDTO);


    /**
     * 查询合计,包含总数
     *
     * @param packingMaterialGoodsDTO
     * @return
     */
    PackingMaterialGoodsVO queryListSum(PackingMaterialGoodsDTO packingMaterialGoodsDTO);

    /**
     * 保存
     * @param entity
     * @return
     */
    @Override
    boolean save(PackingMaterialGoods entity);

    /**
     * 生成包材快速匹配号  由商品+商品数量+#组成
     *
     * @param packingMaterialGoodsList
     * @return
     */
    String genPackingMaterialGoodsFastMatching(List<PackingMaterialGoods> packingMaterialGoodsList);


    /**
     * 普通复核添加 包材关系 并生成包材记录
     * @param packingMaterialGoodsDTO
     * @return
     */
    boolean saveAndGenRecordForGeneralReview(PackingMaterialGoodsDTO packingMaterialGoodsDTO);

    /**
     * 爆品复核添加 包材关系 并生成包材记录
     * @param packingMaterialGoodsDTO
     * @param deliveryCodeListOfReviewed
     * @return
     */
    boolean saveAndGenRecordForHotReview(PackingMaterialGoodsDTO packingMaterialGoodsDTO, List<String> deliveryCodeListOfReviewed,String groupCode,String creator);

    /**
     * 异步生成包材关系及包材记录信息
     *
     * @param deliveryCodes
     * @param packingMaterialCode
     * @return
     */
    @Async
    void savePackingMaterialGoodsAndGenRecord(List<String> deliveryCodes, String packingMaterialCode, String groupCode, String creator, String wavePickingCode);

    /**
     * 异步生成包材关系及包材记录信息
     *
     * @param deliveryCode
     * @param packingMaterialCode
     * @param groupCode
     * @return
     */
    @Async
    void savePackingMaterialGoodsAndGenRecord(String deliveryCode,String packingMaterialCode,String groupCode);

}
